﻿using System;
using Newtonsoft.Json.Linq;
using KKCai.TC.App;

namespace KKCai.TC.Job
{
    internal class MyJob : Quartz.IJob
    {
        private const string url = "http://www.cailele.com/static/termInfo/53.txt";

        public void Execute(Quartz.JobExecutionContext context)
        {
            string phase = String.Empty;
            string result = String.Empty;

            try
            {
                string resp = new WebUtils().DoGet(url);

                JObject o = JObject.Parse(resp);

                phase = (string)o.SelectToken("openTerm");
                result = (string)o.SelectToken("openResult");
            }
            catch { return; }

            new Manager().Save(phase, result);
        }
    }
}
